package cn.ht.jywrwater.module.ht.dal.mysql.waterqualitydata;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.waterqualitydata.WaterQualityDataDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.waterqualitydata.vo.*;

/**
 * 水质数据 Mapper
 *
 * @author hzx
 */
@Mapper
public interface WaterQualityDataMapper extends BaseMapperX<WaterQualityDataDO> {

    default PageResult<WaterQualityDataDO> selectPage(WaterQualityDataPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WaterQualityDataDO>()
                .eqIfPresent(WaterQualityDataDO::getDeviceCode, reqVO.getDeviceCode())
                .betweenIfPresent(WaterQualityDataDO::getDataTime, reqVO.getDataTime())
                .eqIfPresent(WaterQualityDataDO::getQualityType, reqVO.getQualityType())
                .orderByDesc(WaterQualityDataDO::getId));
    }

    default List<WaterQualityDataDO> selectList(WaterQualityDataExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WaterQualityDataDO>()
                .eqIfPresent(WaterQualityDataDO::getDeviceCode, reqVO.getDeviceCode())
                .betweenIfPresent(WaterQualityDataDO::getDataTime, reqVO.getDataTime())
                .eqIfPresent(WaterQualityDataDO::getQualityType, reqVO.getQualityType())
                .orderByDesc(WaterQualityDataDO::getId));
    }

}
